package com.genexususa.eo.google.test.feed;


import com.genexususa.eo.google.connection.FeedManager;
import com.genexususa.eo.google.data.CampaignReport;
import com.genexususa.eo.google.data.FeedReport;
import com.genexususa.eo.google.data.GA_CampaignStats;
import com.genexususa.eo.google.data.GA_Report;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import java.io.StringWriter;
import java.util.ArrayList;

public class ConsumeGetAllFeedsReport {

    public static void main(String[] args){

        FeedManager fm = new FeedManager();
        fm.SetClientId("6877352682");
        ArrayList<FeedReport> reports = fm.GetAllFeedsReport("6877352682");
        fm.Finalize();

        GA_Report report = new GA_Report();

        report.Feeds = reports;


        try {

            String result = "";
            JAXBContext contextObj = JAXBContext.newInstance(GA_Report.class);
            Marshaller marshallerObj = contextObj.createMarshaller();
            marshallerObj.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            StringWriter sw = new StringWriter();
            marshallerObj.marshal(report, sw);
            result = sw.getBuffer().toString();
            System.out.println(result);

        } catch (Exception exc) {
            exc.printStackTrace();
        }
    }
}
